use catia::{ComApartment, CatiaApp, com_get};
use catia::variant::variant_to_i32;
use windows::core::Result as WinResult;

fn main() -> WinResult<()> {
    let _apartment = ComApartment::init_sta()?;
    let app = CatiaApp::new()?;
    let docs = app.documents()?;
    let v = com_get!(docs, "Count")?;
    if let Ok(Some(count)) = variant_to_i32(&v) {
        println!("Documents.Count = {}", count);
    }
    Ok(())
}